Skip to content

[rom_ctrl,dv] Rewrite a rom_ctrl vseq to avoid tl_access_sub#29942

Open
rswarbrick wants to merge 1 commit into
lowRISC:masterfrom
rswarbrick:rom-ctrl-tl-access-sub
Open

[rom_ctrl,dv] Rewrite a rom_ctrl vseq to avoid tl_access_sub#29942
rswarbrick wants to merge 1 commit into
lowRISC:masterfrom
rswarbrick:rom-ctrl-tl-access-sub

Conversation

@rswarbrick
Copy link
Copy Markdown
Contributor

This task was really intended to be internal, so maybe it's better not to use it directly. Upsettingly, avoiding that means you have to duplicate a bit of its contents, but that turns out to be cleaner than I feared.

I've also expanded out the error messages and (hopefully) made it a bit more obvious what the sequence is doing.

@rswarbrick rswarbrick requested a review from KinzaQamar April 28, 2026 12:54
@rswarbrick rswarbrick added Component:DV DV issue: testbench, test case, etc. IP:rom_ctrl labels Apr 28, 2026
@rswarbrick rswarbrick marked this pull request as ready for review April 28, 2026 12:54
@rswarbrick rswarbrick requested a review from a team as a code owner April 28, 2026 12:54
@rswarbrick rswarbrick requested review from hcallahan-lowrisc and removed request for a team April 28, 2026 12:54
Comment thread hw/ip/rom_ctrl/dv/env/seq_lib/rom_ctrl_corrupt_sig_fatal_chk_vseq.sv Outdated
Comment thread hw/ip/rom_ctrl/dv/env/seq_lib/rom_ctrl_corrupt_sig_fatal_chk_vseq.sv Outdated
Comment thread hw/ip/rom_ctrl/dv/env/seq_lib/rom_ctrl_corrupt_sig_fatal_chk_vseq.sv Outdated
@rswarbrick rswarbrick force-pushed the rom-ctrl-tl-access-sub branch from f93b922 to 3288935 Compare April 30, 2026 08:11
@rswarbrick
Copy link
Copy Markdown
Contributor Author

Force-push rebases and addresses most of the comments above.

Copy link
Copy Markdown
Contributor

@KinzaQamar KinzaQamar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :)

Copy link
Copy Markdown
Contributor

@marnovandermaas marnovandermaas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments mainly for me to understand the change better.

// an integrity error.
if (seq.rsp.d_error) begin
`uvm_error(`gfn, $sformatf("Unexpected error reading from address 0x%0h", addr))
end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: should we have an empty line between end and if?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. In that version, I was grouping the two checks together as "the checks to do when the sequence has completed". But that's rather ugly. I've just split them up and also (I think) improved the comments.

task rom_ctrl_corrupt_sig_fatal_chk_vseq::corrupt_rom_address();
addr_range_t loc_mem_range[$] = cfg.ral_models["rom_ctrl_prim_reg_block"].mem_ranges;
dv_base_reg_block blk = cfg.ral_models["rom_ctrl_prim_reg_block"];
int mem_idx = $urandom_range(0, blk.mem_ranges.size - 1);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't used.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean mem_idx? It's used as the index for the array access on the next line.

cfg.rom_ctrl_vif.override_bus_rom_index(corr_bus_rom_rom_index_val);
end
read_word(addr, corr_data, 1'b0);
cfg.rom_ctrl_vif.override_bus_rom_index(corr_bus_rom_rom_index_val);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this index set?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops! Nowhere! Thanks for noticing.

cfg.rom_ctrl_vif.override_bus_rom_index(corr_bus_rom_rom_index_val);
end
read_word(addr, corr_data, 1'b0);
cfg.rom_ctrl_vif.override_bus_rom_index(corr_bus_rom_rom_index_val);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why don't we override the index before the read?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah: the problem is that override_bus_rom_index consumes time: it waits until a_valid is asserted and then forces the index until a_valid drops again.

Looking closely at the code (dating back to the original version in 0c4edc1), it does assume that there won't be any other bus accesses already in flight: it assumes that when a_valid is asserted, that must be the word we're trying to read.

That's probably not unreasonable for this FI test though, I hope.

Copy link
Copy Markdown
Contributor Author

@rswarbrick rswarbrick May 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about this a bit in bed(!) and wonder whether the name of this task in the interface could be better. But I'm struggling to think of something short and clear. The best I could come up with was override_bus_rom_index_during_request, but I'm not really convinced. Any ideas?

Another idea: override_bus_rom_index_throughout_request.

@rswarbrick rswarbrick force-pushed the rom-ctrl-tl-access-sub branch from 3288935 to 86ea6b7 Compare May 9, 2026 21:47
This task was really intended to be internal, so maybe it's better not
to use it directly. Upsettingly, avoiding that means you have to
duplicate a bit of its contents, but that turns out to be cleaner than
I feared.

I've also expanded out the error messages and (hopefully) made it a
bit more obvious what the sequence is doing.

Signed-off-by: Rupert Swarbrick <rswarbrick@lowrisc.org>
@rswarbrick rswarbrick force-pushed the rom-ctrl-tl-access-sub branch from 86ea6b7 to b0e84ef Compare May 9, 2026 21:47
@rswarbrick rswarbrick requested a review from marnovandermaas May 9, 2026 21:48
@rswarbrick
Copy link
Copy Markdown
Contributor Author

The double force-push is to rebase onto master. If comparing versions, the first "compare" button (here) points at the changes I've made to respond to the review. The second compare button is just the enormous changes from a rebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component:DV DV issue: testbench, test case, etc. IP:rom_ctrl

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants